package com.allen.workflow.delegate;

import lombok.Data;
import org.camunda.bpm.engine.delegate.DelegateExecution;

import java.util.Map;

/**
 * @program: spring-boot-demo
 * @className BusinessExecution
 * @description: 根据业务需要扩展Camunda的DelegateExecution对象
 * @Version 1.0
 * @author: zp
 * @create: 2024-08-16 13:51
 * @Version 1.0
 **/
@Data
public class BusinessExecution {

    private final DelegateExecution delegateExecution;
    private final String definitionKey;
    private final String eventName;
    private final String camundaProcessDefinitionId;
    private final String processInstanceId;
    private final Map<String, Object> variables;

    public BusinessExecution(DelegateExecution delegateExecution) {
        this.delegateExecution = delegateExecution;
        this.definitionKey = delegateExecution.getProcessBusinessKey();
        this.eventName = delegateExecution.getEventName();
        this.camundaProcessDefinitionId = delegateExecution.getProcessDefinitionId();
        this.processInstanceId = delegateExecution.getProcessInstanceId();
        this.variables = delegateExecution.getVariables();
    }

}
